]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Add pan action to FolderView
authorCarlos Soriano <carlos.soriano89@gmail.com>
Fri, 23 Aug 2013 18:49:27 +0000 (20:49 +0200)
committerCarlos Soriano <carlos.soriano89@gmail.com>
Mon, 2 Sep 2013 18:36:39 +0000 (20:36 +0200)
Since we have now a ScrollView in the FolderView,
add support for the pan action

https://bugzilla.gnome.org/show_bug.cgi?id=706081

js/ui/appDisplay.js

index bef866e3d1cf9568b535fa5d1ae961d48c9cf152..59ca4972771dabd426377e53db20de9cd56c0d1e 100644 (file)
@@ -884,6 +884,10 @@ const FolderView = new Lang.Class({
         let scrollableContainer = new St.BoxLayout({ vertical: true, reactive: true });
         scrollableContainer.add_actor(this._grid.actor);
         this.actor.add_actor(scrollableContainer);
+
+        let action = new Clutter.PanAction({ interpolate: true });
+        action.connect('pan', Lang.bind(this, this._onPan));
+        this.actor.add_action(action);
     },
 
     _getItemId: function(item) {
@@ -921,6 +925,13 @@ const FolderView = new Lang.Class({
         return icon;
     },
 
+    _onPan: function(action) {
+        let [dist, dx, dy] = action.get_motion_delta(0);
+        let adjustment = this.actor.vscroll.adjustment;
+        adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
+        return false;
+    },
+
     adaptToSize: function(width, height) {
         this._parentAvailableWidth = width;
         this._parentAvailableHeight = height;